package main

import (
	"fmt"
	"strconv"
)

func myMax(num1,num2 int) int{
	var res int
	if num1 > num2 {
		res = num1
	}else{
		res = num2
	}
	return  res
}

func swp(x,y string) (string,string){
	return  y ,x
}

func multiplicationTable() {
	for i := 1; i <= 9; i++ {
		for j := 1; j <= i; j++ {
			var ret string
			if i*j < 10 && j != 1 {
				ret = " " + strconv.Itoa(i*j)
			} else {
				ret = strconv.Itoa(i * j)
			}

			fmt.Print(j, " * ", i, " = ", ret, "   ")
		}
		fmt.Print("\n")
	}
}


const LINES int = 10

// 杨辉三角
func ShowYangHuiTriangle() {
	nums := []int{}
	for i := 0; i < LINES; i++ {
		//补空白
		for j := 0; j < (LINES - i); j++ {
			fmt.Print(" ")
		}
		for j := 0; j < (i + 1); j++ {
			var length = len(nums)
			var value int
			if j == 0 || j == i {
				value = 1
			} else {
				value = nums[length-i] + nums[length-i-1]
			}
			nums = append(nums, value)
			fmt.Print(value, " ")
		}
		fmt.Println("")
	}
}


func main(){
	 //a  := myMax(20,30)
	 //fmt.Printf("最大的数字为 %d",a)
	// a , b := swp("min","bo")
	//fmt.Printf(" %s  %s",a,b)
	//multiplicationTable()
	ShowYangHuiTriangle()
}